# include <stdio.h>
# include <stdbool.h>
# include <math.h>
bool find2prime_mult(int );
bool prime_number(int );
int main(void)
{
    int t;
    scanf("%d",&t);
    int a[t];
    int i;

    for(i=0;i<t;i++)  //输入
    {
        scanf("%d",&a[i]);
    }

    for(i=0;i<t;i++)  //依次遍历
    {
        if( find2prime_mult(a[i]) )
            printf("YES\n");
        else
            printf("NO\n");
    }

    return 0;
}
bool find2prime_mult(int num)
{
    int i;
    for(i=2;i<=(num/i);i++)
    {
        if(prime_number(i) && (0==num%i) && prime_number(num/i))
            return true;
    }
    return false;
}

bool prime_number(int num)
{
    int i=2;
    for(;i<=sqrt(num);i++)
    {
        if(0 == (num%i))
        {
            return false;
        }
    }
    return true;
}